package com.gotop.auth.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gotop.auth.service.IUserService;
import com.gotop.common.utils.ApplicationStringUtils;
import com.gotop.entity.user.User;
import com.gotop.entity.user.UserOauth;
import com.gotop.info.UserInfo;
import com.gotop.mapper.user.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: cem
 * @description:
 * @author: superfish
 * @create: 2020-12-21 15:24
 **/
@Service
public class UserService implements IUserService {

    @Autowired
    private UserDao userDao;

    @Override
    public boolean submit(User user) {
        return false;
    }

    @Override
    public IPage<User> selectUserPage(IPage<User> page, User user) {
        return null;
    }

    @Override
    public UserInfo userInfo(Long userId) {
        return null;
    }

    @Override
    public UserInfo userInfo(String tenantId, String account, String password) {
        UserInfo userInfo = new UserInfo();
        User user = userDao.getUser(tenantId, account, password);
        userInfo.setUser(user);
        if (null != user) {
            List<String> roleAlias = userDao.getRoleAlias(ApplicationStringUtils.toStrArray(user.getRoleId()));
            userInfo.setRoles(roleAlias);
        }
        return userInfo;
    }

    @Override
    public UserInfo userInfo(UserOauth userOauth) {
        return null;
    }

    @Override
    public boolean grant(String userIds, String roleIds) {
        return false;
    }

    @Override
    public boolean resetPassword(String userIds) {
        return false;
    }

    @Override
    public boolean updatePassword(Long userId, String oldPassword, String newPassword, String newPassword1) {
        return false;
    }

    @Override
    public List<String> getRoleName(String roleIds) {
        return null;
    }

    @Override
    public List<String> getDeptName(String deptIds) {
        return null;
    }

    @Override
    public boolean registerGuest(User user, Long oauthId) {
        return false;
    }
}
